//如何让 var [a, b] = {a: 1, b: 2} 解构赋值成功？
const obj = {
  a: 1,
  b: 2,
  [Symbol.iterator]: function () {
    let i = 0
    const keyArr = Object.keys(this)
    return {
      next: function () {
        const result = {
          done: i > keyArr.length,
          value: obj[keyArr[i]],
        }
        i++
        return result
      },
    }
  },
}
var [a, b] = obj
console.log(a, b)
